package com.shixi.shixitraining.shixitraining.ui.tabmine.activity;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;

import com.shixi.shixitraining.shixitraining.R;
import com.shixi.shixitraining.shixitraining.ui.tabmine.adapter.MyApplyPagerAdapter;
import com.shixi.shixitraining.shixitraining.util.TitleUtil;

public class MyApplyActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_apply);
        initTitle();
        initView();
    }


    private void initTitle() {
        TitleUtil titleUtil = new TitleUtil(findViewById(R.id.top_bar_layout));
        titleUtil.initTitle(4, R.id.top_bar_center_tv, R.id.top_bar_left_img, 0, R.drawable.icon_back,
                0, "我的申请", "", "");
        ImageView mBackImg = (ImageView) findViewById(R.id.top_bar_left_img);
        mBackImg.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.top_bar_left_img:
                this.finish();
                break;
        }
    }

    private void initView() {

        TabLayout mTab = (TabLayout) findViewById(R.id.tab_apply);
        ViewPager mViewPager = (ViewPager) findViewById(R.id.viewpager_apply);
        mTab.setTabMode(TabLayout.MODE_FIXED);
        mTab.setupWithViewPager(mViewPager);

        MyApplyPagerAdapter adapter = new MyApplyPagerAdapter(getSupportFragmentManager());
        mViewPager.setAdapter(adapter);
    }


}
